<template>
  <div class="order">
    <NavBar title="售后服务"></NavBar>
    <div v-for="item in list" :key="item.id">
      <div class="order-item" v-if="item.status == 1">
        <div class="item-header">
          <div class="item-date">{{ item.buy_time }}</div>
          <div class="item-total">数量</div>
        </div>
        <div class="item-main">
          <div class="item-pic">
            <img
              src="http://qhps40fk6.hn-bkt.clouddn.com/product2.png"
              alt=""
            />
          </div>
          <div class="item-info">
            <div class="item-name">{{ item.content }}</div>
            <div class="item-code">订单编号: {{ item.serial_number }}</div>
          </div>
          <div class="item-total">1</div>
        </div>
        <div class="item-operate">
          <!-- <div class="item-btn">购买意外险</div> -->
          <!-- <div class="item-btn" @click="launchAfter(item.id)">发起售后</div> -->
          <div v-if="item.status == 1">后台正在审核，请耐心等待</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import NavBar from "../components/NavBar";
export default {
  data() {
    return {
      list: [],
    };
  },
  created() {
    this.fetchData();
  },
  methods: {
    fetchData() {
      this.$axios.get("/order/order").then((res) => {
        this.list = res.data.data;
      });
    },
    // 新增订单按钮
    clickBtn() {
      this.$router.push("add-order");
    },
    // 发起售后
    launchAfter(orderid) {
      this.$router.push("launch-after?orderid=" + orderid);
    },
  },
  components: {
    NavBar,
  },
};
</script>

<style lang="scss" scoped>
.order {
  background-color: #f0f0f0;
  padding-top: 1.1728rem;
  padding-bottom: 1.4928rem;
  .order-item {
    margin-bottom: 0.08rem;
    background-color: #fff;
    .item-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      font-size: 0.426667rem;
      color: #757777;
      padding: 0.426667rem 0.64rem;
      padding-right: 0.44rem;
      border-bottom: 1px solid rgb(247, 244, 244);
    }
    .item-total {
      width: 1.666667rem;
      text-align: center;
      font-size: 0.426667rem;
    }
    .item-main {
      padding: 0.4rem;
      display: flex;
      align-items: center;
      justify-content: center;
      border-bottom: 1px solid rgb(247, 244, 244);
      .item-pic {
        width: 2.506667rem;
        img {
          width: 100%;
        }
      }
      .item-info {
        flex: 1;
        padding-left: 0.266667rem;
        .item-name {
          font-size: 0.4rem;
          color: #757777;
        }
        .item-code {
          font-size: 0.32rem;
          color: #949494;
          padding-top: 0.346667rem;
        }
      }
    }
    .item-operate {
      padding: 0.346667rem 0.613333rem;
      display: flex;
      align-items: center;
      justify-content: flex-end;
      .item-btn {
        background: linear-gradient(0deg, #4d79ef, #6a95f4);
        color: #fff;
        padding: 0.24rem 0.426667rem;
        border-radius: 0.08rem;
        margin-left: 0.266667rem;
      }
    }
  }
}
</style>